FROM wuyufei1993/ambari-agent:2.7.5

RUN ssh-keygen -t rsa -f /root/.ssh/id_rsa -q -P ""

RUN yum install -y ambari-server


# add mysql and psql connectors to ambari-server so it can be downloaded by services (e.g.: Ranger)
ADD https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.49.tar.gz /var/lib/ambari-server/resources/mysql-jdbc-driver.jar
ADD https://jdbc.postgresql.org/download/postgresql-42.2.14.jar /var/lib/ambari-server/resources/postgres-jdbc-driver.jar
RUN yum install -y mysql-connector-java
RUN cp /usr/share/java/mysql-connector-java.jar /var/lib/ambari-server/resources/mysql-connector-java.jar
RUN yum install -y sshpass

ADD start-server.sh /root/start-server.sh

ENV AMBARI_AGENT '10.0.0.8,10.0.0.9,10.0.0.12'
ENV DATABASE 'mysql'
ENV DATABASE_HOST '10.0.0.12'
ENV DATABASE_PORT 3306
ENV DATABASE_NAME 'ambari'
ENV DATABASE_USERNAME 'ambari'
ENV DATABASE_PASSWORD '1q2w3e@@Ambari'